package hk.hku.hooku.util;

import java.sql.Timestamp;
import java.util.Date;

public class TimeUtil {
	public static Date toDate(Timestamp time){
		Date date=new Date(time.getYear(),time.getMonth(),time.getDate());
		return date;
	}
	
	public static final String[] MONTHS={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
	public static final String[] DAYS={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
	
	public static String toShortMonth(Date date){
		return MONTHS[date.getMonth()];
	}
	
	public static String toShortDay(Date date){
		return DAYS[date.getDay()];
	}
	
	public static Timestamp createNullTimestamp(){
		return new Timestamp(0);
	}
	
	public static boolean isNullTimestamp(Timestamp time){
		Timestamp nullTime=new Timestamp(0);
		return time.equals(nullTime);
	}
}
